using System;
using System.Collections;
using Rdl;

namespace GTame.ReportParser
{

    public class GroupingType
    {

        private GTame.ReportParser.CustomPropertiesType _CustomProperties;
        private string _DataCollectionName;
        private string _DataElementName;
        private Rdl.GroupingTypeDataElementOutput _DataElementOutput;
        private GTame.ReportParser.FiltersType _Filters;
        private GTame.ReportParser.GroupExpressionsType _GroupExpressions;
        private string _Label;
        private System.Nullable<bool> _PageBreakAtEnd;
        private System.Nullable<bool> _PageBreakAtStart;
        private string _Parent;
        private string nameField;

        public GTame.ReportParser.CustomPropertiesType CustomProperties
        {
            get
            {
                if (_CustomProperties == null)
                    _CustomProperties = new GTame.ReportParser.CustomPropertiesType();
                return _CustomProperties;
            }
            set
            {
                _CustomProperties = value;
            }
        }

        public string DataCollectionName
        {
            get
            {
                return _DataCollectionName;
            }
            set
            {
                _DataCollectionName = value;
            }
        }

        public string DataElementName
        {
            get
            {
                return _DataElementName;
            }
            set
            {
                _DataElementName = value;
            }
        }

        public Rdl.GroupingTypeDataElementOutput DataElementOutput
        {
            get
            {
                return _DataElementOutput;
            }
            set
            {
                _DataElementOutput = value;
            }
        }

        public GTame.ReportParser.FiltersType Filters
        {
            get
            {
                if (_Filters == null)
                    _Filters = new GTame.ReportParser.FiltersType();
                return _Filters;
            }
            set
            {
                _Filters = value;
            }
        }

        public GTame.ReportParser.GroupExpressionsType GroupExpressions
        {
            get
            {
                if (_GroupExpressions == null)
                    _GroupExpressions = new GTame.ReportParser.GroupExpressionsType();
                return _GroupExpressions;
            }
            set
            {
                _GroupExpressions = value;
            }
        }

        public string Label
        {
            get
            {
                return _Label;
            }
            set
            {
                _Label = value;
            }
        }

        public string Name
        {
            get
            {
                return nameField;
            }
            set
            {
                nameField = value;
            }
        }

        public System.Nullable<bool> PageBreakAtEnd
        {
            get
            {
                return _PageBreakAtEnd;
            }
            set
            {
                _PageBreakAtEnd = value;
            }
        }

        public System.Nullable<bool> PageBreakAtStart
        {
            get
            {
                return _PageBreakAtStart;
            }
            set
            {
                _PageBreakAtStart = value;
            }
        }

        public string Parent
        {
            get
            {
                return _Parent;
            }
            set
            {
                _Parent = value;
            }
        }

        public GroupingType()
        {
            _PageBreakAtEnd = new System.Nullable<bool>[]();
            _PageBreakAtStart = new System.Nullable<bool>[]();
        }

        public Rdl.GroupingType Write()
        {
            Rdl.GroupingType groupingType = new Rdl.GroupingType();
            System.Collections.ArrayList arrayList1 = new System.Collections.ArrayList();
            System.Collections.ArrayList arrayList2 = new System.Collections.ArrayList();
            groupingType.Name = nameField;
            if (_CustomProperties != null)
            {
                arrayList1.Add(_CustomProperties.Write());
                arrayList2.Add(1);
            }
            if (_DataCollectionName != null)
            {
                arrayList1.Add(_DataCollectionName);
                arrayList2.Add(2);
            }
            if (_DataElementName != null)
            {
                arrayList1.Add(_DataElementName);
                arrayList2.Add(3);
            }
            arrayList1.Add(_DataElementOutput);
            arrayList2.Add(4);
            if (_Filters != null)
            {
                arrayList1.Add(_Filters.Write());
                arrayList2.Add(5);
            }
            if (_GroupExpressions != null)
            {
                arrayList1.Add(_GroupExpressions.Write());
                arrayList2.Add(6);
            }
            if (_Label != null)
            {
                arrayList1.Add(_Label);
                arrayList2.Add(7);
            }
            if (_PageBreakAtEnd.get_HasValue())
            {
                arrayList1.Add(_PageBreakAtEnd);
                arrayList2.Add(8);
            }
            if (_PageBreakAtStart.get_HasValue())
            {
                arrayList1.Add(_PageBreakAtStart);
                arrayList2.Add(9);
            }
            if (_Parent != null)
            {
                arrayList1.Add(_Parent);
                arrayList2.Add(10);
            }
            groupingType.Items = arrayList1.ToArray();
            groupingType.ItemsElementName = (Rdl.ItemsChoiceType17[])arrayList2.ToArray(typeof(Rdl.ItemsChoiceType17));
            arrayList2 = arrayList1 = null;
            return groupingType;
        }

    } // class GroupingType

}

